﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Power.View;
using Power.View.Dialog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ToolTip;

namespace Power.ViewModel
{
    public class DataImportViewModel : ViewModelBase
    {
        private DataImport model;
        public DataImportViewModel(DataImport model)
        {
            this.model = model;
            UploadTestResults = new RelayCommand(OnUploadTestResults);
            VideoMigration = new RelayCommand(OnVideoMigration);
        }

        //检测结果上传
        private void OnUploadTestResults()
        {
            DataUpload box = new DataUpload();
            var result = box.ShowDialog();
            if (result == true) {
                PleaseModify box2 = new PleaseModify();
                var flag = box2.ShowDialog();
                if (flag == true)
                {
                    DataCenter dc = ((Window.GetWindow(this.model) as MainWindow).DataContext as MainViewModel).UserContent as DataCenter;
                    dc.Context.OnTabSwitch(dc.TestRecord);
                }
            }
        }

        //视频上传
        private void OnVideoMigration()
        {
            System.Windows.Forms.OpenFileDialog ofld = new System.Windows.Forms.OpenFileDialog();
            if (ofld.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string text = ofld.FileName;
                if (text != "" || text != null)
                {
                    //处理后续
                }
            }
        }

        #region
        public RelayCommand UploadTestResults { get; private set; }

        public RelayCommand VideoMigration { get; private set; }

        #endregion
    }
}
